package gsde.springboot.eurekaserver;

public class GsdeServiceProperty {
    protected String processUUID;
    protected String hostip;
    protected int port;
    protected String serviceName;
    protected String serviceRunMsg;
    protected long updateTime;
    protected long startTime;  //开始运行时间，第一次运行时间

    protected int checkTimes = 0;
    public GsdeServiceProperty()
    {

    }

    public GsdeServiceProperty(String hostip, int port, String serviceName)
    {
        this.hostip = hostip;
        this.port = port;
        this.serviceName = serviceName;
    }

    /**
     * 设置服务运行信息
     * @param msg
     */
    public void  setServiceRunMsg(String msg)
    {
        this.serviceRunMsg = msg;
    }

    /**
     * 设置开始时间
     * @param startTime
     */
    public void setStartTime(long startTime)
    {
        this.startTime = startTime;
    }

    public String getHostip()
    {
        return this.hostip;
    }

    public int getPort()
    {
        return this.port;
    }

    public String getServiceName()
    {
        return this.serviceName;
    }

    public String getServiceRunMsg()
    {
        return this.serviceRunMsg;
    }

    public long getStartTime()
    {
        return this.startTime;
    }

    /**
     * 获取运行时长
     * @return
     */
    public long getRunTime()
    {
        return System.currentTimeMillis() - this.startTime;
    }

    public void setUpdateTime(long updateTime)
    {
        this.updateTime = updateTime;
    }

    public long getUpdateTime()
    {
        return this.updateTime;
    }

    public void addCheckTimes()
    {
        this.checkTimes++;

        if (this.checkTimes >= 6) {
            this.checkTimes = 1;
        }
    }

    public int getCheckTimes()
    {
        return this.checkTimes;
    }
}
